#while 实现九九乘法表

#1
a=1
while a<=9:
      b=1
      while b<=a:
            print("{}*{}={:<4}".format(a,b,a*b),end="")
            b+=1
      print(end='\n')
      a+=1
              


#2
a=9
while a>=1:
      b=1
      while b<=a:
            print("{}*{}={:<4}".format(a,b,a*b),end="")
            b+=1
      print(end='\n')
      a-=1



#3
a=9
while a>=1:
      b=a
      print(" "*8*(9-a),end="")
      while b>=1:
            print("{}*{}={:<4}".format(a,b,a*b),end="")
            b-=1
      print(end='\n')
      a-=1



#4
a=1
while a<=9:
      b=a
      print(" "*8*(9-a),end="")
      while b>=1:
            print("{}*{}={:<4}".format(a,b,a*b),end="")
            b-=1
      print(end='\n')
      a+=1



#for in 实现九九乘法表
      
#1
for a in range(1,10):
    for b in range(1,a+1):
        print("{}*{}={:<4}".format(a,b,a*b),end="")
    print(end='\n')


#2
for a in range(9,0,-1):
    for b in range(1,a+1):
        print("{}*{}={:<4}".format(a,b,a*b),end="")
    print(end='\n')


#3
for a in range(9,0,-1):
    print(" "*8*(9-a),end="")
    for b in range(a,0,-1):
        print("{}*{}={:<4}".format(a,b,a*b),end="")
    print(end='\n')


#4
for a in range(1,10):
    print(" "*8*(9-a),end="")
    for b in range(a,0,-1):
        print("{}*{}={:<4}".format(a,b,a*b),end="")
    print(end='\n')
    

